﻿using Abp.Domain.Repositories;
using System;
using System.Collections.Generic;
using System.Linq;
using Yozeev.BusinessLogic;

namespace Yozeev.Controllers.Stats.Filters
{
    public class DeviceFilter : AbstractFilter
    {
        private readonly IRepository<Device, Guid> _deviceRep;

        public DeviceFilter(IRepository<Device, Guid> deviceRep)
        {
            _deviceRep = deviceRep;
        }

        public override void Decorate(Dictionary<string, IEnumerable<object>> Data)
        {
            if (Data.ContainsKey("Devices")) return;
            var devices = _deviceRep.GetAll();
            Data.Add("Devices", devices.ToList());
        }
    }
}
